<%--
 *  File:    monthendcloseoff.jsp
 *  @Author: Kent Zhong
 *  Date:    9/11/2002 16:27
 *
 *  Copyright (C) 2000 - 2003 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.*" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>


<% //--------------------------------------  setting logger --%>
<%
  	Category cat = Category.getInstance("jsp.monthendcloseoff");
%>

<% //--------------------------------------  variant and initialization --%>
<%
	String strModuleName = "GL";
  String privilegeCode = "40504";

%>

<% //--------------------------------------  include files list --%>

<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<html>
<head>
<PageFlow:CheckPageFlow pageName="monthendcloseoff"/>
<%
  HashMap userinfo = (HashMap) session.getAttribute("userinfo");
  if (userinfo == null)
    userinfo = new HashMap();
  Integer glaccperiodid = (Integer) userinfo.get("glaccperiodid");
  if (glaccperiodid == null)
    glaccperiodid = new Integer(-1);

  String isneed = "isneed";
  String actiontype = "actiontype";
  if (glaccperiodid.equals(pageContext.getAttribute("lastperiodid"))) {
    isneed = "isneed2";
    actiontype = "actiontype2";
  }

  Integer lastperiodid = (Integer) pageContext.getAttribute("lastperoidid");
  if (lastperiodid == null)
    lastperiodid = new Integer(-1);

%>
<title>MonthEndCloseOff</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../js/ScriptLib.js"></script>
<script languagecode="javascript">
	
window.onload =function (){
		var lockfistatus=frm.lockfistatus.value;
		
	if(lockfistatus=="<%=label.getLabelName("L_Success")%>"){
	
  alert('<%=message.getMessageDesc("LOGIN_AGAIN")%>');

	 frm.actionname.value="logout";
	 frm.target="_top";
	 isRunning=true;
	 frm.submit();
	}
else if(lockfistatus==null||lockfistatus==""){
		return;
		frm.target="_self";
    isRunning=true;
    frm.submit();
}

}
function page_examine()
{

    if(!confirm('<%=message.getMessageDesc("ARE_YOU_SURE")%>' + '(<custom:write name="periodinfo" property="accyear"/>-' + '<custom:write name="periodinfo" property="no"/>)')) return;
    frm.target="_self";
    frm.actionname.value="check";
    isRunning=true;
    frm.submit();
}
function page_checkend(notmust,checkstatus)
{
  if(isEmpty(notmust) || notmust=='false')
  {
    if (!confirm('<%=message.getMessageDesc("CHECK_END_CONTINUE_SAVE_ACCOUNT")%>'))
      return;
    frm.isaccountsave.value="Y";
    frm.target="_self";
    frm.actionname.value="saveaccount";
    isRunning=true;
    frm.submit();
  }
  else if(notmust=='true' && checkstatus=='true')
  {
    if (!confirm('<%=message.getMessageDesc("NOT_SUCCESS_CHECK_END_CONTINUE_SAVE_ACCOUNT")%>'))
      return;
    frm.isaccountsave.value="Y";
    frm.target="_self";
    frm.actionname.value="saveaccount";
    isRunning=true;
    frm.submit();
  }
  else if( checkstatus=='false')
  {
    alert('<%=message.getMessageDesc("NOT_SUCCESS_CHECK_END")%>');
    return;
  }
}
function page_saveaccount()
{
  if(!confirm('<%=message.getMessageDesc("ARE_YOU_SURE")%>' + '(<custom:write name="periodinfo" property="accyear"/>-' + '<custom:write name="periodinfo" property="no"/>)')) return;
  frm.isaccountsave.value="N";
  frm.target="_self";
  frm.actionname.value="saveaccount";
  isRunning=true;
  frm.submit();
}
function page_unsaveaccount()
{
  if(!confirm('<%=message.getMessageDesc("ARE_YOU_SURE")%>' + '(<custom:write name="periodinfo" property="accyear"/>-' + '<custom:write name="periodinfo" property="no"/>)')) return;
  frm.target="_self";
  frm.actionname.value="unsaveaccount";
  isRunning=true;
  frm.submit();
}
</script>
</head>
<body>
<%@ include file="/inc/PageLocation.inc" %>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
<form name="frm" method="post" action="../Dispatcher"  target="_self">
    <input type="hidden" name="pagename" value="monthendcloseoff">
    <input type="hidden" name="actionname">
    <input type="hidden" name="passlabel" value="<%=label.getLabelName("L_CheckPass",false)%>">
    <input type="hidden" name="notpasslabel" value="<%=label.getLabelName("L_CheckNotPass",false)%>">
    <input type="hidden" name="successlabel" value="<%=label.getLabelName("L_Success",false)%>">
    <input type="hidden" name="unsuccesslabel" value="<%=label.getLabelName("L_UnSuccess",false)%>">
    <custom:hidden property="checksuccessflag"/>
    	<custom:hidden property="lockfistatus" />
    <input type="hidden" name="isaccountsave">
    <custom:hidden property="lastperiodid"/>
    <custom:hidden property="checkelementtype"/>
    <custom:hidden property="booksetid"/>

  <input type="hidden" name="nulldate" value=" ">
  <input type="hidden" name="nullinteger" value=" ">

  <tr>
    <td>
      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
        <tr class="deepblue-left">
          <td colspan="5"><img src="../images/<%= strLanguageCode %>/quote.gif"> <%=label.getLabelName("L_CheckList")%></td>
        </tr>

          <tr class="td-listrom">
            <td class="title_center" width="30"><%=label.getLabelName("L_SerialCode")%></td>
            <td class="title_center" width="30"><%= label.getLabelName("L_IfCheck") %></td>
            <td class="title_center" width="300"><%=label.getLabelName("L_CheckContent")%></td>
            <td class="title_center"><%=label.getLabelName("L_RptDescription")%></td>
            <td class="title_center" width="200"><%=label.getLabelName("L_CheckResult")%></td>
          </tr>
          <%
            Vector checkelements=(Vector)pageContext.getAttribute("checkelements");
            if(checkelements==null)
              checkelements=new Vector();
            String strClass="td-listrom";
          %>
          <logic:iterate id="checkelementsitem" collection="<%= checkelements %>" indexId="idx">
          <%
            if (idx.intValue() % 2 == 0)
              strClass = "none";
            else
              strClass = "td-listrom";
          %>
          <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull(strClass)%>'" class="<%=JspHelper.filterNull(strClass)%>">
            <td>&nbsp;<%=JspHelper.filterNull( idx.intValue() + 1 )%>
            </td>
            <td>&nbsp;<custom:checkbox name="checkelementsitem" property="<%=isneed%>" checkFlag="1/0" colIndex="<%=idx%>" styleClass="checkbox" disabled="true"/></td>
            <td><custom:write name="checkelementsitem" property="name" nbsp="true"/></td>
            <td><custom:write name="checkelementsitem" property="description" nbsp="true"/></td>
            <td><custom:write name="checkelementsitem" property="checkresultname" nbsp="true"/></td>
            <custom:hidden name="checkelementsitem" property="name" colIndex="<%=idx%>"/>
            <custom:hidden name="checkelementsitem" property="checkresultname" colIndex="<%=idx%>"/>
            <custom:hidden name="checkelementsitem" property="refclass" colIndex="<%=idx%>"/>
            <custom:hidden name="checkelementsitem" property="<%= isneed %>" colIndex="<%=idx%>"/>
            <custom:hidden name="checkelementsitem" property="<%= actiontype %>" colIndex="<%=idx%>"/>
          </tr>
          </logic:iterate>
          <input type="hidden" name="numrows" value="<%=JspHelper.filterNull(checkelements.size())%>">
      </table>
      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
        <tr class="deepblue-left">
          <td colspan="3"><img src="../images/<%= strLanguageCode %>/quote.gif"> <%=label.getLabelName("L_LockOperate")%></td>
        </tr>

          <tr class="td-listrom">
            <td width="30" class="title_center"><%=label.getLabelName("L_SerialCode")%></td>
            <td class="title_center"><%=label.getLabelName("L_ProcContent")%></td>
            <td class="title_center"><%=label.getLabelName("L_ProcResult")%></td>
          </tr>
          <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='none'" class="none">
            <td>1</td>
            <td><%=label.getLabelName("L_LockOperate")%></td>

            <td><custom:write property="lockfistatus" nbsp="true" /></td>
          </tr>
          <!--<tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='td-listrom'" class="td-listrom">-->
            <!--<td>2</td>-->
            <!--<td><%=label.getLabelName("L_LockFIAccount")%></td>-->
            <!--<td><custom:write property="lockfistatus" nbsp="true" /></td>-->
          <!--</tr>-->

      </table>
      <table width="100%" cellspacing="0" cellpadding="0">
        <tr>
          <td class="summary_top"></td>
        </tr>
        <tr>
          <td class="td_center">
          <%
            Boolean oHasSavesFlag=(Boolean)pageContext.getAttribute("hassavesflag");
            if(oHasSavesFlag==null)
              oHasSavesFlag=new Boolean(false);
            Boolean oSaveSuccFlag=(Boolean)pageContext.getAttribute("saveaccountsuccessflag");
            String strIsAccountSave=(String)pageContext.getAttribute("isaccountsave");
            if(strIsAccountSave==null)
              strIsAccountSave="N";
            if(oSaveSuccFlag==null)
              oSaveSuccFlag=new Boolean(false);
            if(!oSaveSuccFlag.booleanValue())
            {
          %>
            <a onclick="page_saveaccount();"><custom:button type="1" label="L_MonthAS" imgsrc="monthAS.gif" border="0" style="width:60"/></a>
            <a onclick="page_examine();"><custom:button type="1" label="L_Examine" imgsrc="Examine.gif" border="0" style="width:60"/></a>
          <%}else{%>
           
            <%}
              Boolean oCheckSuccFlag=(Boolean)pageContext.getAttribute("checksuccessflag");
              if(oCheckSuccFlag==null)
                oCheckSuccFlag=new Boolean(false);
              %>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  </form>
</table>
</body>
<%@include file="/inc/AlertError.inc"%>
<%if( pageContext.getAttribute("checksuccessflag")!=null && !oSaveSuccFlag.booleanValue()&& oHasSavesFlag.booleanValue() && !strIsAccountSave.equalsIgnoreCase("Y"))
  {
%>
<script language="javascript">
page_checkend('<custom:write property="notmustcheckfailflag"/>','<%=JspHelper.filterNull(oCheckSuccFlag.booleanValue())%>');
</script>
<%--a href="javascript:page_checkend('<custom:write property="notmustcheckfailflag"/>','<%=JspHelper.filterNull(oCheckSuccFlag.booleanValue())%>');"><%=label.getLabelName("L_CheckEnd")%></a--%>
<%}%>
</html>


